package br.com.bd2.hibernate.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(uniqueConstraints = {@UniqueConstraint(name = "uk_grade_item_codigo", columnNames = {"codigoGradeItem"})})
public class GradeItem {
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_grade_item")
	@SequenceGenerator(name = "seq_grade_item", sequenceName = "seq_grade_item")
	private Long id;
	
	@Column(nullable=false)
	private Long codigoGradeItem;
	
	@Column(length=50)
	private String nome;

	@ManyToOne
	@JoinColumn(name = "grade", nullable=false)
	private Grade grade;
		
	@ManyToOne
	@JoinColumn(name = "cor")
	private Cor cor;

	@ManyToOne
	@JoinColumn(name = "tamanho")
	private Tamanho tamanho;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getCodigoGradeItem() {
		return codigoGradeItem;
	}

	public void setCodigoGradeItem(Long codigoGradeItem) {
		this.codigoGradeItem = codigoGradeItem;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Grade getGrade() {
		return grade;
	}

	public void setGrade(Grade grade) {
		this.grade = grade;
	}

	public Cor getCor() {
		return cor;
	}

	public void setCor(Cor cor) {
		this.cor = cor;
	}

	public Tamanho getTamanho() {
		return tamanho;
	}

	public void setTamanho(Tamanho tamanho) {
		this.tamanho = tamanho;
	}
}
